  $(function() {
    // $('img.image1').data('ad-desc', 'Whoa! This description is set through elm.data("ad-desc") instead of using the longdesc attribute.<br>And it contains <strong>H</strong>ow <strong>T</strong>o <strong>M</strong>eet <strong>L</strong>adies... <em>What?</em> That aint what HTML stands for? Man...');
    // $('img.image1').data('ad-title', 'Title through $.data');
    // $('img.image4').data('ad-desc', 'This image is wider than the wrapper, so it has been scaled down');
    // $('img.image5').data('ad-desc', 'This image is higher than the wrapper, so it has been scaled down');
    var galleries = $('.ad-gallery').adGallery();
    $('#switch-effect').change(
      function() {
        galleries[0].settings.effect = $(this).val();
        return false;
      }
    );
    $('#toggle-slideshow').click(
      function() {
        galleries[0].slideshow.toggle();
        return false;
      }
    );
    $('#toggle-description').click(
      function() {
        if(!galleries[0].settings.description_wrapper) {
          galleries[0].settings.description_wrapper = $('#descriptions');
        } else {
          galleries[0].settings.description_wrapper = false;
        }
        return false;
      }
    );
	
	//改动的地方
	   var _list = $("#imgList");
    //点击缩略图时
    _list.find('a').on('click', function () {
        console.log(33333);
        var showName = $(this).find('img').attr('src');
        var index_one = showName.lastIndexOf('/'); //最后一个'/'的位置
        var index_two = showName.lastIndexOf('.'); //最后一个'.'的位置
        showName = showName.substring(index_one + 1, index_two); //获得最后一个‘/’和最后一个'.'之间的字符串
        var index_three = showName.indexOf('.'); //上一步字符串中间获取第一个'.'的位置
        showName = showName.substring(0, index_three);
        $("#imgName").html(showName)
    });

	_list.find('a').first().click();
	
    var imgCount = _list.find('li').length;//图片的数量
    //点击大图左右按钮切换时
    $(".ad-next-image").on("click", function () {
        _list.find("img").each(function () {
            console.log();
            if ($(this).css('opacity') == 1) { //找到点击之前下面缩略图显示的那张
                if($(this).parent().hasClass('ad-thumb9')){ //如果点击之前的是最后一张
                    _list.find('li').first().find("img").click();
                }else{
                    $(this).parent().parent().next().find('img').click(); //它下面的那张，也就是要显示的那张
                }
            }
        })
    })
  });